﻿<UserControl 
    x:Class="GuidGeneratorSilverlight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:guids="clr-namespace:Guids;assembly=Guids"
    xmlns:local="clr-namespace:GuidGeneratorSilverlight">
    
    <UserControl.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="TextWrapping" Value="Wrap" />
        </Style>
        <Style TargetType="RadioButton">
            <Setter Property="Margin" Value="4" />
        </Style>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="4" />
        </Style>
        <Style TargetType="CheckBox">
            <Setter Property="Margin" Value="4" />
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="4" />
        </Style>
        <local:GuidFormatToBooleanConverter x:Key="guidFormatToBooleanConverter" />
    </UserControl.Resources>
    <Border Name="LayoutRoot" Background="White" BorderThickness="2" BorderBrush="Gray" CornerRadius="4" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Name="TitleBar" Orientation="Horizontal" Background="SkyBlue">
                <Image Stretch="None" Source="Resources/Guid16.png" Margin="4" />
                <TextBlock Text="GUID Generator" VerticalAlignment="Center" FontWeight="Bold" Foreground="Black" />
            </StackPanel>
            <TextBlock Grid.Row="1" Text="GUID Format:" />
            <RadioButton Grid.Row="2" IsChecked="{Binding Path=GuidFormat, Mode=TwoWay, Converter={StaticResource guidFormatToBooleanConverter}, ConverterParameter=None}" Click="OnRadioButtonGuidFormat_Click" Tag="None">
                <TextBlock>
                    <Bold>N:</Bold> 32 digits:<LineBreak />
                    <LineBreak />00000000000000000000000000000000
                </TextBlock>
            </RadioButton>
            <RadioButton Grid.Row="3" IsChecked="{Binding Path=GuidFormat, Mode=TwoWay, Converter={StaticResource guidFormatToBooleanConverter}, ConverterParameter=Dashes}" Click="OnRadioButtonGuidFormat_Click" Tag="Dashes">
                <TextBlock>
                    <Bold>D:</Bold> 32 digits separated by hyphens:<LineBreak />
                    <LineBreak />00000000-0000-0000-0000-000000000000
                </TextBlock>
            </RadioButton>
            <RadioButton Grid.Row="4" IsChecked="{Binding Path=GuidFormat, Mode=TwoWay, Converter={StaticResource guidFormatToBooleanConverter}, ConverterParameter=CurlyBraces}" Click="OnRadioButtonGuidFormat_Click" Tag="CurlyBraces">
                <TextBlock>
                    <Bold>B:</Bold> 32 digits separated by hyphens, enclosed in braces:<LineBreak />
                    <LineBreak />{00000000-0000-0000-0000-000000000000}
                </TextBlock>
            </RadioButton>
            <RadioButton Grid.Row="5" IsChecked="{Binding Path=GuidFormat, Mode=TwoWay, Converter={StaticResource guidFormatToBooleanConverter}, ConverterParameter=Parentheses}" Click="OnRadioButtonGuidFormat_Click" Tag="Parentheses">
                <TextBlock>
                    <Bold>P:</Bold> 32 digits separated by hyphens, enclosed in parentheses:<LineBreak />
                    <LineBreak />(00000000-0000-0000-0000-000000000000)
                </TextBlock>
            </RadioButton>
            <RadioButton Grid.Row="6" IsChecked="{Binding Path=GuidFormat, Mode=TwoWay, Converter={StaticResource guidFormatToBooleanConverter}, ConverterParameter=Hexadecimal}" Click="OnRadioButtonGuidFormat_Click" Tag="Hexadecimal">
                <TextBlock>
                    <Bold>X:</Bold> Four hexadecimal values enclosed in braces, where the fourth value
                    <LineBreak /> is a subset of eight hexadecimal values that is also enclosed in braces:<LineBreak />
                    <LineBreak />{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
                </TextBlock>
            </RadioButton>
            <CheckBox Grid.Row="7" IsChecked="{Binding Path=UpperCase, Mode=TwoWay}" Content="Upper-case" Checked="OnCheckBoxUpperCase_Checked" Unchecked="OnCheckBoxUpperCase_Unchecked" />
            <StackPanel Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Left">
                <Button Click="OnButtonGenerateGuid_Click">Generate GUID</Button>
                <Button Click="OnButtonGenerateMultipleGuids_Click" >Generate Multiple GUIDs...</Button>
                <Button Click="OnButtonCopy_Click" Name="buttonCopy" IsEnabled="False" >Copy to clipboard</Button>
            </StackPanel>
            <TextBox Grid.Row="9" Name="textBoxCurrent" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"/>
        </Grid>
    </Border>
</UserControl>
